package com.ygqh.baby.service;

import com.ygqh.baby.ao.*;
import com.ygqh.baby.model.YgCouponModel;
import com.ygqh.baby.po.YgCoupon;
import com.ygqh.baby.po.YgCouponDetail;
import com.ygqh.baby.po.YgUser;

import java.util.Date;
import java.util.List;

public interface YgCouponDetailService {

	List<YgCouponDetail> find();

	int findCount();

	YgCouponDetail findById(Long id, Long userId);

	int deleteSoft(Long[] ids, Long userId);

	int deleteSoft(Long id, Long userId);

	int save(YgCouponDetail ygCouponDetail);

	int update(YgCouponDetail ygCouponDetail);

	int saveOrUpdate(YgCouponDetail ygCouponDetail);

	ResultSet<YgCouponDetail> search(QueryInfo queryInfo, Long supplierId, CouponStatus cStatus, String q, Long couponBatchId, String userName);

	ResultSet<YgCouponDetail> search(QueryInfo queryInfo, Long supplierId, CouponType couponType, CouponStatus cStatus, Long[] batchIds, String q,
			Date startDate, Date endDate, String mobile, Boolean isReissue);

	/**
	 * 批量插入优惠卷详细
	 * 
	 * @param detailList
	 * @return
	 */
	int addCouponDetailBatch(List<YgCouponDetail> detailList);

	YgCouponDetail findByCouponCode(String couponCode, Long userId);

	List<YgCouponDetail> findByCouponBatchId(Long couponBatchId, Long userId);

	/**
	 * 领取优惠卷
	 * 
	 * @param couponBatchId
	 * @return
	 */
	Message receiveCoupon(Long couponBatchId, YgUser user);

	Message receiveCoupon(Long parseLong, Date endDate, YgUser user);

	Long usePostponeCoupon(YgCoupon coupon, YgUser user);

	/**
	 * 补发优惠卷
	 * 
	 * @param couponBatchId
	 *            批次ID
	 * @param username
	 *            领卷人
	 * @param remark
	 *            备注
	 * @param executor
	 *            处理人
	 * @return
	 */
	Message distributeCoupon(Long couponBatchId, String username, String remark, String executor);

	int updateBatch(List<YgCouponDetail> couponList);

	Message receiveIncreateCoupon(Long couponBatchId, YgUser user);

	int addPostponeCouponDetailBatch(List<YgCouponDetail> detailList);

	Message receiveCouponWithRemark(Long couponBatchId, String remark, YgUser user);

	int transferCoupon(Long sourceUserId, Long targetUserId);

	Message sendBatchCoupon(YgCoupon coupon, List<YgUser> userList);

	int findCount(Long userId, Long... couponBatchId);

	List<YgCouponModel> findOverListForRemind(String overDate, SalesPlatform salesPlatform);
}
